Class Artist


  • public class Artist
    extends java.lang.Object
    This class represents an artist of performing arts, like a band.
    Since:
    ExerciseSheet01
    Version:
    3
    Author:
    Jonas Altrock (ew20b126@technikum-wien.at)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String name
      holds the name of the artist
    • Constructor Summary

      Constructors 
      Constructor Description
      Artist()
      creates a default artist
      Artist​(java.lang.String name)
      creates an artist with a certain name
      Artist​(Artist other)
      creates a copy of an artist
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getName()
      gets the name of this artist.
      void setName​(java.lang.String name)
      sets the name of this artist.
      java.lang.String toString()
      returns a String representation of this Artist
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        private java.lang.String name
        holds the name of the artist

        initial value should be unknown

        Since:
        ExerciseSheet01
    • Constructor Detail

      • Artist

        public Artist()
        creates a default artist

        a default artists name is the String "unknown" (without quotes)

      • Artist

        public Artist​(java.lang.String name)
        creates an artist with a certain name
        Parameters:
        name - the name of this artist
      • Artist

        public Artist​(Artist other)
        creates a copy of an artist
        Parameters:
        other - the original artist to be copied
    • Method Detail

      • getName

        public java.lang.String getName()
        gets the name of this artist.
        Returns:
        the name
      • setName

        public void setName​(java.lang.String name)
        sets the name of this artist.

        the name of an artist cannot be null or empty. if an invalid argument is passed to the method the state of the object remains unchanged

        Parameters:
        name - the new name of the artist
      • toString

        public java.lang.String toString()
        returns a String representation of this Artist

        This should be either the name of the Artist, or "unknown" if the name is not available

        Overrides:
        toString in class java.lang.Object
        Returns:
        the string representation